{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "61c1a6e5-2d86-4674-975d-51ba0e9540eb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'encoding': 'ascii', 'confidence': 1.0, 'language': ''}"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from chardet import detect\n",
    "\n",
    "detect(b'hello world')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "b02e5a84-1559-4014-a59f-9b5c740d5506",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'encoding': None, 'confidence': 0.0, 'language': None}"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data= '哪吒2'.encode('GB2312')\n",
    "detect(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fcbf0a25-5953-492f-8d8e-cc8d92b72907",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.21"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
